import ajax from './ajax'
import store from '../store' 
const baseUrl = process.env.NODE_ENV === 'production' ? '' : '/api'
// console.log(baseUrl)
// const baseUrl = 'http://192.168.3.37:8200'


// const baseUrl ='http://117.73.2.3:8102'


// 登录
export const login = (data) => ajax({
  url: baseUrl + '/admin/Admin/login',
  data: data,
  method: 'post'
})
// 添加管理员
export const addAdmin = (data) => ajax({
  url: baseUrl + '/admin/Admin/addAdmin',
  data: data,
  method: 'post'
})
// 编辑管理员
export const editAdmin = (data) => ajax({
  url: baseUrl + '/admin/Admin/editAdmin',
  data: data,
  method: 'post'
})
// 删除管理员
export const deleteAdmin = (data) => ajax({
  url: baseUrl + '/admin/Admin/deleteAdmin',
  data: data,
  method: 'post'
})
// 管理员列表
export const adminList = (data) => ajax({
  url: baseUrl + '/admin/Admin/adminList',
  data: data,
  method: 'get'
})
// 角色列表
export const groupList = (data) => ajax({
  url: baseUrl + '/admin/Auth/groupList',
  data: data,
  method: 'get'
})
// 添加角色
export const addGroup = (data) => ajax({
  url: baseUrl + '/admin/Auth/addGroup',
  data: data,
  method: 'post'
})
// 编辑角色
export const updateGroup = (data) => ajax({
  url: baseUrl + '/admin/Auth/updateGroup',
  data: data,
  method: 'post'
})
// 删除角色
export const deleteGroup = (data) => ajax({
  url: baseUrl + '/admin/Auth/deleteGroup',
  data: data,
  method: 'post'
})
// 权限列表
export const authListAll = (data) => ajax({
  url: baseUrl + '/admin/Auth/authListAll',
  data: data,
  method: 'post'
})
// 添加权限
export const addAuth = (data) => ajax({
  url: baseUrl + '/admin/Auth/addAuth',
  data: data,
  method: 'post'
})
// 删除权限
export const deleteAuth = (data) => ajax({
  url: baseUrl + '/admin/Auth/deleteAuth',
  data: data,
  method: 'post'
})
// 编辑权限
export const editAuth = (data) => ajax({
  url: baseUrl + '/admin/Auth/editAuth',
  data: data,
  method: 'post'
})
// 登录者管理的停车场列表
export const parkingLotListByLoginId = (data) => ajax({
  url: baseUrl + '/admin/Admin/parkingLotListByLoginId',
  data: data,
  method: 'get'
})
// 车辆列表
export const carList = (data) => ajax({
  url: baseUrl + '/admin/car/carList',
  data: data,
  method: 'get'
})
// 添加车辆
export const addCar = (data) => ajax({
  url: baseUrl + '/admin/car/addCar',
  data: data,
  method: 'post'
})
// 编辑车辆
export const editCar = (data) => ajax({
  url: baseUrl + '/admin/car/editCar',
  data: data,
  method: 'post'
})
// 编辑车辆
export const deleteCar = (data) => ajax({
  url: baseUrl + '/admin/car/deleteCar',
  data: data,
  method: 'post'
})
// 车辆黑名单
export const blacklist = (data) => ajax({
  url: baseUrl + '/admin/car/blacklist',
  data: data,
  method: 'get'
})
// 解除车辆黑名单
export const cancelBlacklist = (data) => ajax({
  url: baseUrl + '/admin/car/cancelBlacklist',
  data: data,
  method: 'post'
})
// 设备列表
export const deviceList = (data) => ajax({
  url: baseUrl + '/admin/Device/deviceList',
  data: data,
  method: 'get'
})
// 停车场的大门列表
export const gateListByParkingLotId = (data) => ajax({
  url: baseUrl + '/admin/Device/gateListByParkingLotId',
  data: data,
  method: 'get'
})
// 获取停车场的车位
export const allParkingPlaceList = (data) => ajax({
  url: baseUrl + '/admin/Device/allParkingPlaceList',
  data: data,
  method: 'get'
})
// 设备数量
export const deviceCount = (data) => ajax({
  url: baseUrl + '/admin/Device/deviceCount',
  data: data,
  method: 'get'
})
// 添加设备
export const addDevice = (data) => ajax({
  url: baseUrl + '/admin/Device/addDevice',
  data: data,
  method: 'post'
})
// 编辑设备
export const editDevice = (data) => ajax({
  url: baseUrl + '/admin/Device/editDevice',
  data: data,
  method: 'post'
})
// 删除设备
export const deleteDevice = (data) => ajax({
  url: baseUrl + '/admin/Device/deleteDevice',
  data: data,
  method: 'post'
})
// 公告列表
export const announceList = (data) => ajax({
  url: baseUrl + '/admin/system/announceList',
  data: data,
  method: 'get'
})
// 消息列表
export const messageList = (data) => ajax({
  url: baseUrl + '/admin/system/messageList',
  data: data,
  method: 'get'
})
// 删除消息
export const deleteMessage = (data) => ajax({
  url: baseUrl + '/admin/system/deleteMessage',
  data: data,
  method: 'post'
})
// 消息详情
export const messageDetail = (data) => ajax({
  url: baseUrl + '/admin/system/messageDetail',
  data: data,
  method: 'get'
})
// 公告详情
export const announceDetail = (data) => ajax({
  url: baseUrl + '/admin/system/announceDetail',
  data: data,
  method: 'get'
})
// 发布公告
export const announce = (data) => ajax({
  url: baseUrl + '/admin/system/announce',
  data: data,
  method: 'post'
})
// 账单汇总
export const bill = (data) => ajax({
  url: baseUrl + '/admin/bill/bill',
  data: data,
  method: 'get'
})
// 账单列表
export const billList = (data) => ajax({
  url: baseUrl + '/admin/bill/billList',
  data: data,
  method: 'get'
})
// 账单列表
export const exportday = baseUrl + '/admin/bill/export?admin_id=' + store.state.adminId + '&type=' + 'day' + '&time=' + new Date(new Date().toLocaleDateString()).getTime() / 1000
export const exportmonth = baseUrl + '/admin/bill/export?admin_id=' + store.state.adminId + '&type=' + 'month' + '&time=' + new Date(new Date().getFullYear(),new Date().getMonth(),1).getTime() / 1000

// 订单列表
export const allOrderList = (data) => ajax({
  url: baseUrl + '/admin/Order/allOrderList',
  data: data,
  method: 'get'
})

// 车位列表
export const placeList = (data) => ajax({
  url: baseUrl + '/admin/parking/placeList',
  data: data,
  method: 'get'
})
// 添加车位
export const addPlace = (data) => ajax({
  url: baseUrl + '/admin/parking/addPlace',
  data: data,
  method: 'post'
})
// 编辑车位
export const editPlace = (data) => ajax({
  url: baseUrl + '/admin/parking/editPlace',
  data: data,
  method: 'post'
})
// 删除车位
export const deletePlace = (data) => ajax({
  url: baseUrl + '/admin/parking/deletePlace',
  data: data,
  method: 'post'
})
// 添加停车场
export const addParkingLot = (data) => ajax({
  url: baseUrl + '/admin/parking/addParkingLot',
  data: data,
  method: 'post'
})
// 删除停车场
export const deleteParkingLot = (data) => ajax({
  url: baseUrl + '/admin/parking/deleteParkingLot',
  data: data,
  method: 'post'
})
// 区域列表
export const partitionList = (data) => ajax({
  url: baseUrl + '/admin/parking/partitionList',
  data: data,
  method: 'get'
})
// 删除区域
export const deletePartition = (data) => ajax({
  url: baseUrl + '/admin/parking/deletePartition',
  data: data,
  method: 'post'
})
// 修改区域
export const editPartition = (data) => ajax({
  url: baseUrl + '/admin/parking/editPartition',
  data: data,
  method: 'post'
})
// 添加区域
export const addPartition = (data) => ajax({
  url: baseUrl + '/admin/parking/addPartition',
  data: data,
  method: 'post'
})
// 停车场详情
export const parkingLotDetail = (data) => ajax({
  url: baseUrl + '/admin/parking/parkingLotDetail',
  data: data,
  method: 'get'
})
// 停车场列表
export const parkingLotList = (data) => ajax({
  url: baseUrl + '/admin/parking/parkingLotList',
  data: data,
  method: 'get'
})
// 上传图片
export const uploadImage = (data) => ajax({
  url: baseUrl + '/admin/system/uploadImage',
  data: data,
  headers: {
    'Content-Type': '*'
  },
  method: 'post'
})
